/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.dp1.persistencia.bd;

import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.RemoteServer;
import java.rmi.server.*;

/**
 *
 * @author javier
 */
public class ServidorDePersistencia {

    static Registry registry;

    public static void main(String[] argv) {
        //if (System.getSecurityManager() == null) {
        //    System.setSecurityManager(new RMISecurityManager());
        //}
        //System.setProperty("java.rmi.server.codebase", "/home/javier/Escritorio/cargadinamica/");
        //System.setProperty("java.security.policy", "/home/javier/Escritorio/java.policy");
     

        try {
            registry = LocateRegistry.createRegistry(1099);
            System.setSecurityManager(new RMISecurityManager());
            //registry = LocateRegistry.getRegistry("192.168.1.201",1099);
            //Naming.rebind("//192.168.1.201:1099/BaseDatos", new BaseDatos());
            //Naming.rebind("//192.168.43.160:1099/BaseDatos", new BaseDatos());
            Naming.rebind("//192.168.0.35:1099/BaseDatos", new BaseDatos());
                
            System.out.println("Servidor Persistencia listo...");
            System.out.println("vehiculos has been published");
            System.out.println(RemoteServer.getClientHost());
        } catch (Exception e) {
            System.out.println("Servidor fallo... " + e);
        }
    }
}
